package ltd.hxya.novel.user.controller;


import ltd.hxya.novel.common.bean.Result;
import ltd.hxya.novel.user.entity.UserBookshelf;
import ltd.hxya.novel.user.service.IUserBookshelfService;
import ltd.hxya.novel.user.vo.UserBookshelfVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * <p>
 * 用户书架表 前端控制器
 * </p>
 *
 * @author hxya
 * @since 2022-09-13
 */
@RestController
@RequestMapping("/user/bookshelf")
public class UserBookshelfController {

    private ExecutorService executor = Executors.newCachedThreadPool() ;

    @Autowired
    private IUserBookshelfService userBookshelfService;

    /**
     * 根据用户id，查询该用户书架上的所有小说
     */
    @GetMapping("/listBookByUserId")
    public Result<List<UserBookshelfVo>> listBookByUserId(){
        List<UserBookshelfVo> userBookshelfVos = userBookshelfService.listBookByUserId();
        return Result.success(userBookshelfVos);
    }

}
